package com.shop.shard.service.product.impl;

import com.shop.shard.entity.product.Product;
import com.shop.shard.mapper.product.ProductMapper;
import com.shop.shard.service.product.ProductService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;

/**
* @Description: TODO
* @author:
* @Createed Date: 2018/11/21-10:26
* @ModificationHistory: Who  When  What
* ---------     -------------   --------------------------------------
**/

@Service
@Transactional(rollbackFor = Exception.class)
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductMapper productMapper;

    @Override
    public void delete(Integer[] ids) {
        productMapper.deleteBatchIds(Arrays.asList(ids));
    }

    @Override
    public void addEntity(Product entity) {
        productMapper.insert(entity);
    }

    @Override
    public void updateEntity(Product entity) {
        productMapper.updateById(entity);
    }
}